<?php
namespace Mobile\Controller;

class IndexController extends MobileBaseController {

    public function index(){
        //banner图片切换
        $banner_list = M('ad')->where("pid = 1")->order('orderby asc')->select();
        $this->assign('banner_list',$banner_list);

        //推荐商品
        $goods_cat_list = M('goods_category')->field("id,name,evaluation_money,parent_id_path,image")->where("level = 3 AND is_hot = 1 ")->limit(4)->select();
        foreach($goods_cat_list as $key => $val){
            $parent_id_path_arr = explode("_",$goods_cat_list[$key]['parent_id_path']);
            $goods_cat_list[$key]['f_id'] = $parent_id_path_arr[1];
            $goods_cat_list[$key]['s_id'] = $parent_id_path_arr[2];
            $goods_cat_list[$key]['t_id'] = $parent_id_path_arr[3];
        } //查询底部的分类
        $cate=M('article_cat')->where('parent_id=0')->order('sort_order desc')->select();
        $this->assign('cate',$cate);
        $this->assign('goods_cat_list',$goods_cat_list);
        $this->display();
       
    }
}